<template>
  <view class="container">
    <view class="status-bar"></view>
    
    <view class="header">
      <view class="header-left">
        <view class="search-btn">
          <text class="icon">🔍</text>
        </view>
      </view>
      <view class="header-center">
        <text class="title">武夷山摩崖石刻</text>
        <text class="subtitle">WUYISHAN ROCK CARVINGS</text>
      </view>
      <view class="header-right">
        <view class="menu-btn">
          <text class="icon">⋯</text>
        </view>
        <view class="location-btn">
          <text class="icon">📍</text>
        </view>
      </view>
    </view>

    <scroll-view class="main-content" scroll-y>
      <!-- 优化英雄区域，增大图片尺寸，调整布局 -->
      <view class="hero-section">
        <!-- 添加武夷山摩崖石刻图片 -->
        <view class="hero-image">
          <image src="https://hebbkx1anhila5yf.public.blob.vercel-storage.com/465ffa014afa3e56da9599d68766c593-w40mxCoptSGlsPLUsSOxX2wdQzcEPm.jpg" mode="aspectFill"></image>
        </view>
      </view>

      <!-- 只保留研学课程一个按钮，居中显示，增大尺寸 -->
      <view class="function-section">
        <view class="function-card" @tap="handleFunction('course')">
          <view class="function-icon">
            <text>📚</text>
          </view>
          <view class="function-info">
            <text class="function-title">研学课程</text>
            <text class="function-desc">探索武夷山文化精髓</text>
          </view>
          <view class="function-arrow">
            <text>→</text>
          </view>
        </view>
      </view>

      <!-- 修改标题为"必看石刻"，优化卡片样式 -->
      <view class="recommend-section">
        <view class="section-header">
          <text class="section-title">必看石刻</text>
          <text class="section-more" @tap="handleMore">全部 ></text>
        </view>
        
        <view class="recommend-card" @tap="handleRecommend('zhuxitiqu')">
          <view class="recommend-image">
            <text class="image-placeholder">朱熹题刻</text>
          </view>
          <view class="recommend-info">
            <view class="recommend-header">
              <text class="recommend-title">朱熹题刻</text>
              <view class="dynasty-badge">宋代</view>
            </view>
            <text class="recommend-desc">"逝者如斯夫，不舍昼夜"</text>
            <text class="recommend-location">📍 天游峰</text>
          </view>
        </view>

        <view class="recommend-card" @tap="handleRecommend('wangxizhi')">
          <view class="recommend-image">
            <text class="image-placeholder">王羲之石刻</text>
          </view>
          <view class="recommend-info">
            <view class="recommend-header">
              <text class="recommend-title">王羲之石刻</text>
              <view class="dynasty-badge ming">明代</view>
            </view>
            <text class="recommend-desc">"兰亭集序"节选</text>
            <text class="recommend-location">📍 九曲溪</text>
          </view>
        </view>

        <view class="recommend-card" @tap="handleRecommend('dongpo')">
          <view class="recommend-image">
            <text class="image-placeholder">苏东坡题刻</text>
          </view>
          <view class="recommend-info">
            <view class="recommend-header">
              <text class="recommend-title">苏东坡题刻</text>
              <view class="dynasty-badge">宋代</view>
            </view>
            <text class="recommend-desc">"水调歌头"诗句</text>
            <text class="recommend-location">📍 一线天</text>
          </view>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script setup>
import { ref } from 'vue'

const handleFunction = (type) => {
  if (type === 'course') {
    uni.navigateTo({
      url: '/pages/study/study'
    })
  }
}

const handleRecommend = (id) => {
  console.log('查看石刻:', id)
  // 可以跳转到石刻详情页
  // uni.navigateTo({
  //   url: `/pages/carving-detail/carving-detail?id=${id}`
  // })
}

const handleMore = () => {
  console.log('查看更多石刻')
}
</script>

<style scoped>
.container {
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, #e8f5e8 0%, #c8e6c9 50%, #81c784 100%);
  color: #2e7d32;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.status-bar {
  height: 44px;
  width: 100%;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-btn, .menu-btn, .location-btn {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.title {
  display: block;
  font-size: 18px;
  font-weight: bold;
  color: #1b5e20;
}

.subtitle {
  display: block;
  font-size: 11px;
  color: #4caf50;
  margin-top: 2px;
  letter-spacing: 1px;
}

.main-content {
  flex: 1;
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
  height: 100%;
  overflow-y: auto;
}

/* 优化英雄区域样式，增大图片，改进布局 */
.hero-section {
  margin-bottom: 24px;
}

.hero-image {
  width: 100%;
  height: 260px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.hero-image image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.function-section {
  margin-bottom: 24px;
}

.function-card {
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 6px 24px rgba(76, 175, 80, 0.3);
  width: 100%;
  box-sizing: border-box;
}

.function-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.function-info {
  flex: 1;
}

.function-title {
  display: block;
  font-size: 20px;
  font-weight: bold;
  color: white;
  margin-bottom: 6px;
}

.function-desc {
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.function-arrow {
  font-size: 24px;
  color: white;
  flex-shrink: 0;
}

/* 优化推荐区域样式 */
.recommend-section {
  margin-bottom: 120px; /* 增加底部空隙，为tabbar留出空间 */
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: bold;
  color: #1b5e20;
}

.section-more {
  color: #4caf50;
  font-size: 14px;
  font-weight: 500;
}

.recommend-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  box-sizing: border-box;
}

.recommend-image {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, #f1f8e9 0%, #dcedc8 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.image-placeholder {
  font-size: 12px;
  color: #81c784;
  font-weight: 500;
}

.recommend-info {
  flex: 1;
  width: 100%;
}

.recommend-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.recommend-title {
  font-size: 18px;
  font-weight: bold;
  color: #1b5e20;
}

.dynasty-badge {
  background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
  color: #1b5e20;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(255, 193, 7, 0.3);
}

.dynasty-badge.ming {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

.recommend-desc {
  display: block;
  font-size: 15px;
  color: #4caf50;
  margin-bottom: 6px;
  font-style: italic;
}

.recommend-location {
  display: block;
  font-size: 13px;
  color: #81c784;
}
</style>
